#include<iostream>
#include<string>
#include<cmath>
#include<map>
using namespace std;
typedef long long LL;
const int N = 1e5 + 10;
string s[N], t[N];
int a[N], b[N];
map<string, int>mp;
int p[N * 2];
int n;
int cnt;
int find1(string s)
{
	if (!mp[s]) {
		mp[s] = ++cnt;
	}
	return mp[s];
}

int find(int x)
{
	if (x != p[x])p[x] = find(p[x]);
	return p[x];
}
int main()
{
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> s[i] >> t[i];
		a[i] = find1(s[i]);
		b[i] = find1(t[i]);
		p[a[i]] = a[i];
		p[b[i]] = b[i];
	}
	bool flag = 0;
	for (int i = 1; i <= n; i++) {
		int x = find(a[i]);
		int y = find(b[i]);
		//cout << "x==" << x << endl;
		//cout << "y==" << y << endl;
		if (x == y) {
			flag = 1;
			break;
		}
		p[x] = y;				
	}
	if (flag)cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}